Skip to content

chore(cua-driver-rs)(nix): cargoLock.lockFile + sync Cargo.lock on bump (kill version drift) - #1934

Merged
f-trycua merged 1 commit into
mainfrom
chore/nix-cargolock-lockfile-no-hash-drift
Jun 18, 2026
Merged

chore(cua-driver-rs)(nix): cargoLock.lockFile + sync Cargo.lock on bump (kill version drift)#1934
f-trycua merged 1 commit into
mainfrom
chore/nix-cargolock-lockfile-no-hash-drift

Conversation

@f-trycua

@f-trycua f-trycua commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The drift, and why it kept biting

The release bump (bump2version) edits only Cargo.toml's [workspace.package] version. It leaves Cargo.lock's 9 workspace-member versions stale, and the Nix package pinned a manual cargoHash that hashes the vendored lockfile. So the committed lock + hash stayed consistent (and green) only by never touching the lock — a frozen-inconsistent state that detonates the moment anyone runs cargo build: it re-locks the members, diverges from the committed lock, and invalidates the hash → every Nix job goes red. That's what hit #1933. The drift had silently accumulated across 0.5.3 → 0.5.6 (Cargo.toml said 0.5.6; Cargo.lock + package.nix still said 0.5.3).

Fix — three changes so it can't recur

  1. package.nix uses cargoLock.lockFile instead of cargoHash. importCargoLock derives each dependency's fixed-output hash from the lockfile itself, so there is no hash to hand-maintainCargo.lock can change freely (version bump, dep update) and the build keeps working. I verified the old "apple crates may be unreachable from crates.io" rationale is false: apple-cf / apple-metal / objc2 are all registry+crates.io with checksums, and there are zero git deps (376 registry / 0 git), so no outputHashes overrides are needed.
  2. package.nix reads version from Cargo.toml ([workspace.package]) instead of a hardcoded literal (which had drifted to 0.5.3).
  3. Re-locked Cargo.lock to 0.5.6, and the bump workflow now runs cargo update --workspace after bump2version and folds the synced lockfile into the bump commit (moving the tag), so the manifest and lockfile ship in sync every release.

Verification

  • CI: the Nix jobs build via cargoLock.lockFile (the load-bearing change — confirms importCargoLock vendors the full dep set with no hash). I can't run Nix on the dev box, so CI is the gate.
  • The Cargo.lock diff is only the 9 workspace-member version bumps (0.5.3→0.5.6); no registry deps changed.
  • The bump-workflow change can't run until the next release, but it's guarded (only acts if Cargo.lock changed; only for cua-driver-rs) and cargo is preinstalled on the runner.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved release automation and build configuration to ensure dependencies are properly synchronized during releases.
    • Enhanced build system to dynamically derive package version and dependencies from source configuration.

…n bump (kill version drift)

The release bump edits only Cargo.toml's `[workspace.package] version`, leaving
Cargo.lock's 9 workspace-member versions stale. Nix pinned a manual `cargoHash`
that hashes the vendored lockfile, so the committed lock + hash stayed mutually
consistent (and green) only by never touching the lock — a frozen-inconsistent
state that detonated the instant anyone ran `cargo build`, which re-locked the
members and invalidated the hash, turning every nix job red (hit on PR #1933).
The drift had silently accumulated across 0.5.3 -> 0.5.6.

Three changes so this can't recur:
1. package.nix uses `cargoLock.lockFile` instead of `cargoHash`. importCargoLock
   derives each dep's hash from the lockfile itself, so there is NO hash to
   hand-maintain — Cargo.lock can change freely and the build keeps working.
   Verified the old "apple crates unreachable from crates.io" rationale is
   false: apple-cf/apple-metal/objc2 are all registry crates and there are zero
   git deps, so no `outputHashes` are needed.
2. package.nix reads `version` from Cargo.toml's `[workspace.package]` instead of
   a hardcoded literal (which had drifted to 0.5.3).
3. Re-locked Cargo.lock to 0.5.6, and the bump workflow now runs
   `cargo update --workspace` after bump2version and folds the synced lockfile
   into the bump commit (moving the tag), so the manifest and lockfile ship in
   sync every release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Jun 18, 2026 3:20am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4c64fc61-d488-49db-8c91-982f1ed69162

📥 Commits

Reviewing files that changed from the base of the PR and between 14058e6 and df2cf59.

⛔ Files ignored due to path filters (1)
  • libs/cua-driver/rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/release-bump-version.yml
  • nix/cua-driver/package.nix

📝 Walkthrough

Walkthrough

The PR adds a release-bump workflow step for cua-driver-rs that runs cargo update --workspace, amends the bump commit with any Cargo.lock changes, and force-moves an existing tag to the amended commit. The Nix cua-driver derivation is updated to derive its version from Cargo.toml dynamically and vendor dependencies from Cargo.lock instead of a hardcoded hash.

Changes

Cargo.lock Synchronization for cua-driver-rs

Layer / File(s) Summary
Nix derivation: dynamic version and lockfile vendoring
nix/cua-driver/package.nix
version is now read from ${src}/Cargo.toml workspace manifest; dependency vendoring switches from a manually maintained cargoHash to cargoLock.lockFile = "${src}/Cargo.lock".
Release workflow: cargo update, commit amend, and tag re-point
.github/workflows/release-bump-version.yml
Adds a cua-driver-rs-only conditional step that runs cargo update --workspace, detects Cargo.lock changes, amends the bump commit to include the updated lockfile, and force-updates any existing tag to the new amended commit SHA.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • trycua/cua#1364: Modifies the same release-bump-version.yml workflow for cua-driver, adding version emission and bump commit wiring that this PR extends with Cargo.lock synchronization and tag re-pointing.

Poem

🐇 Hop, hop, the lockfile's tight,
No stale hashes in the night!
cargo update spins the wheel,
Amended commits make it real.
The tag leaps to the new commit's brow —
Fresh Nix derivation takes a bow! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: replacing cargoHash with cargoLock.lockFile and synchronizing Cargo.lock on version bump to eliminate version drift.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/nix-cargolock-lockfile-no-hash-drift

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@f-trycua
f-trycua merged commit 6fed723 into main Jun 18, 2026
60 of 61 checks passed
@f-trycua
f-trycua deleted the chore/nix-cargolock-lockfile-no-hash-drift branch June 18, 2026 03:32
@github-actions

Copy link
Copy Markdown
Contributor

Linux visual regression artifacts

Matrix jobs now run independently. Download visual artifacts from this workflow run.
Each background-GUI job uploads a .gif of the interaction plus two annotated PNGs (<app>.png raw, <app>-atspi.png with AT-SPI element boxes); the cua-driver-linux-som-overlays artifact adds <app>-som.png cua Set-of-Marks overlays:

  • cua-driver-linux-cursor-click-gif
  • cua-driver-linux-background-terminal-gif
  • cua-driver-linux-parallel-drag-xserver
  • cua-driver-linux-background-gui-chromium
  • cua-driver-linux-background-gui-tk
  • cua-driver-linux-background-gui-gtk3-gedit
  • cua-driver-linux-background-gui-gtk3-mousepad
  • cua-driver-linux-background-gui-gtk3-scite
  • cua-driver-linux-background-gui-gtk4-characters
  • cua-driver-linux-background-gui-qt5-manuskript
  • cua-driver-linux-background-gui-qt5-klog
  • cua-driver-linux-background-gui-qt5-openambit
  • cua-driver-linux-background-gui-qt6-kate
  • cua-driver-linux-background-gui-qt6-kcalc
  • cua-driver-linux-background-gui-qt6-okular
  • cua-driver-linux-background-gui-qt6-qownnotes
  • cua-driver-linux-background-gui-electron-zettlr
  • cua-driver-linux-background-gui-electron-joplin
  • cua-driver-linux-background-gui-electron-logseq
  • cua-driver-linux-som-overlays

Open workflow run and download artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant